package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class LoginActivity extends AppCompatActivity {

    private EditText nameTv;
    private EditText pwdTv;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        Button btnLogin = findViewById(R.id.btn_login);

        nameTv = findViewById(R.id.user_name);
        pwdTv = findViewById(R.id.password);

        btnLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String  nameStr = nameTv.getText().toString();
                String  pwdStr = pwdTv.getText().toString();
                //TODO 判断用户名和密码是否匹配？
                Intent intent = new Intent(LoginActivity.this,  ListViewActivity.class);
                intent.putExtra(Const.USER_NAME_KEY,  nameStr);
                startActivity(intent);
            }
        });
    }
}
